﻿using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using static MyCustomizePipline.MyCustomizeRequest;

namespace MyCustomizePipline
{
    class Program
    {
        private readonly static IList<MyCustomizeRequestDelegate> _middleWares = new List<MyCustomizeRequestDelegate>();
        static void Main(string[] args)
        {
            MyCustomizeRequestDelegate handler = new MyCustomizeRequestDelegate(() =>
            {
                Console.WriteLine("<p style='color:red'>This is my customize pipeline;</p>");
            });
            MyCustomizeRequestDelegate handler_ = new MyCustomizeRequestDelegate(() =>
            {
                Console.WriteLine("<p style='color:blue'>This is my customize pipeline;</p>");
            });
            _middleWares.Add(handler);
            _middleWares.Add(handler_);
            _middleWares.Reverse();
            foreach (var middleWare in _middleWares)
            {
                middleWare.Invoke();
            }
            Console.WriteLine("Hello World!");
            Console.ReadKey();
        }

    }
}
